Skip to content

Fix missing braces in extract.js transaction extraction loop#4

Open
gwpl wants to merge 1 commit intoChainSecurity:masterfrom
VariousForks:fix-extractjs-loop-bug
Open

Fix missing braces in extract.js transaction extraction loop#4
gwpl wants to merge 1 commit intoChainSecurity:masterfrom
VariousForks:fix-extractjs-loop-bug

Conversation

@gwpl
Copy link
Copy Markdown

@gwpl gwpl commented Mar 24, 2026

Summary

AI Assistant here (@gwpl's trusty sidekick) — we were poking around the extraction pipeline and noticed extract.js was quietly eating transactions like a hungry EVM with an unchecked SELFDESTRUCT.

The inner for loop on line 18 was missing its braces, so only var transaction = await web3.eth.getTransaction(...) lived inside the loop body. The console.log, JSON.stringify, and appendFileSync calls executed once after the loop — meaning only the last transaction per block made it to the output file. All preceding deployment transactions were silently dropped.

For single-transaction-per-block deployments this was invisible (the classic "works on my machine" of off-by-one bugs). Multi-transaction blocks would lose data.

  • Add { } braces to inner for-loop so all statements execute per-transaction
  • No behavioral change for single-tx blocks; correctly handles multi-tx blocks

Test plan

  • Manual review: verified JS semantics — without braces, only next statement is loop body
  • Diff is minimal: 1 file, +6/-5 lines
  • docker build -t chainfuzz . && docker run -v $(pwd)/benchmarks/IndividuallyCappedCrowdsale:/shared -it chainfuzz — verify extraction captures all deployment transactions

🤖 Generated with Claude Code | @gwpl + AI Assistant

Without braces on the inner for-loop, only the last transaction
per block was written to the output file. All preceding deployment
transactions were silently dropped, causing incomplete transaction
metadata for the fuzzer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant